home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Atari Mega Archive 2
/
Atari Mega Archive CD - Volume 2.iso
/
8bit
/
cislib_a
/
ezclok.doc
< prev
next >
Wrap
Text File
|
1995-04-22
|
3KB
|
106 lines
EZCLOK.XMO is a machine language
utility that allows easy access to the
Atari system clocks. It was written to
eliminate the need for the messy
calculations often required when
using the built in system clock
(Locations 18,19,and 20). Clock access
is performed by doing simple string
manipulations.
HOW IT WORKS
The actual interrupt handler
occupies page six of memory and writes
to the first 14 bytes of the
string-array area. The bytes are
arranged as follows
First 3 bytes.....[AM ] (or PM)
Bytes 4 thru 11...[HH:MM:SS]
Bytes 12 thru 14..[:JJ] (jiffies)
The time can be set or read all at
once or in segments depending on how
you initialize the strings. To set or
read everything at once, you must
DIMension the first string in your
program to 14 bytes-- eg. DIM T$(14).
You must then set the time by setting
the string equal to whatever value
(time) you wish.
EXAMPLE:
POKE 1730,1:REM turn clock off
T$="PM 10:30:45:00"
(HH:MM:SS:JJ)
POKE 1730,0:REM turn clock on
POKE 1730,1 turns off the timer and
should always be used when setting the
clock to ensure reliable operation.
This location can also be used to
start and stop the clock at will. To
read the clock simply read T$ as you
would any other string variable--eg.
PRINT T$. For a different approach,
you can DIMension your strings in the
following manner.
DIM AMPM$(3):REM AM or PM
DIM T$(8):REM HH:MM:SS
DIM JIF$(3):REM jiffies
You can now set or read the hours,
minutes, and seconds without worrying
about whether it is AM or PM or the
jiffies(sixtieths of a second). By the
way, it is the ORDER in which these
strings are TYPED in --not their
names-- which determine what they will
be used for. By the way, all of these
strings must be initialized, even if
they all aren't used.
USING THE PROGRAM
To use the clock in one of your own
programs, type in the following.
LOAD "D:EZCLOK.XMO"
LIST "D:EZCLOK.SUB",20000,20080
NEW
ENTER "D:EZCLOK.SUB"
SAVE "D:EZCLOK.SUB"
There is no need to leave this
subroutine in listed form. In fact, if
you have a program already written and
you would like to add the clock, you
should LIST YOUR PROGRAM to disk, LOAD
the EZCLOK.SUB routine, then you can
enter YOUR program. Then add GOSUB
20000 to the beginning of your
program. I know this seems backwards,
but it will not work the other way
around.
As a final note, there is a nice
little memory move function built into
this subroutine. It can be called by
typing,
X=USR(ADR(MOVE$),from,to,#bytes)
I hope this program has been
helpfull in some way. Please let me
know if you find any use for it. I am
also interested in any comments you
might have.
thanx
mike 74005,475